import { getGameObjectById } from "../engine";
import { Behaviour } from "../engine/Behaviour";
import { TextRenderer } from "../engine/TextRenderer";
import { Transform } from "../engine/Transform";
import { number } from "../engine/validators/number";
import { Display } from "./Display";
import { ItemSpeed } from "./ItemSpeed";

let speed:number;

export class BillTest extends Behaviour {
   // private currentSpeed=0;
   // @number()
   // speed = 5;

    onStart() {
        let sum:number;
        let income:number;
        let time:string;

        this.gameObject.onClick = () => {
             console.log(this.gameObject.id);
             time=getGameObjectById('UI_time_text').getBehaviour(TextRenderer).text;
             console.log(time);
             if(time==="24：00"){
                console.log("弹出账单");               
                getGameObjectById('UI_Bill').getBehaviour(Display).IsActive=true;
                getGameObjectById('Text_day_number').getBehaviour(Display).IsActive=true;
                getGameObjectById('Text_Income').getBehaviour(Display).IsActive=true;
                getGameObjectById('Text_Fee').getBehaviour(Display).IsActive=true;
                getGameObjectById('Text_Rental').getBehaviour(Display).IsActive=true;
                getGameObjectById('Text_cost').getBehaviour(Display).IsActive=true;
                getGameObjectById('Text_profit').getBehaviour(Display).IsActive=true;
             }
             
        };
    }

    onTick(duringTime: number) {

    }
}
